home *** CD-ROM | disk | FTP | other *** search
- ; Static Name Aliases
- ;
- TITLE strnend
- ; NAME strnend.C
-
- ; strnend(src, len)
- ; returns a pointer to just after the end of the string src, which is
- ; terminated by a NUL character, or by exhaustion of the length bound
- ; len. That is, strnend(s,L)-s = strnlen(s,L). s+strnlen(s,L) could
- ; of course be used instead, but this is sometimes clearer.
-
- .287
- _TEXT SEGMENT BYTE PUBLIC 'CODE'
- _TEXT ENDS
- _DATA SEGMENT WORD PUBLIC 'DATA'
- _DATA ENDS
- CONST SEGMENT WORD PUBLIC 'CONST'
- CONST ENDS
- _BSS SEGMENT WORD PUBLIC 'BSS'
- _BSS ENDS
- DGROUP GROUP CONST, _BSS, _DATA
- ASSUME CS: _TEXT, DS: DGROUP, SS: DGROUP, ES: DGROUP
- EXTRN __chkstk:NEAR
- _TEXT SEGMENT
- PUBLIC _strnend
- _strnend PROC NEAR
- push bp
- mov bp,sp
- push di
-
- ; s = 4
- ; register di = s
- ; n = 6
- ; register cx = n
-
- mov di,[bp+4] ;s
- mov cx,[bp+6] ;n
- mov al,0
- repne scasb
- xchg ax,di
- pop di
- mov sp,bp
- pop bp
- ret
-
- _strnend ENDP
- _TEXT ENDS
- END